package uk.ac.manchester.tewpl.iceiface.client.curriculummap;

/*
 * Class to represent the URI of an Airport/Terminal.
 * Used to implement equals between Airport/Terminal and a URI,
 * as String.equals cannot be overridden.
 */
public class Uri {
	
	private String uri;
	private String label;
	
	public Uri(String reqUri) {
		uri = reqUri;
	}
	
	/*public Uri(String reqUri, String lbl) {
		uri = reqUri;
		label = lbl;
	}*/
	
	public boolean equals(Object o) {
		if (o.getClass() == Uri.class)
			return ((Uri)o).toString().equals(uri);
		else if (o.getClass() == Airport.class)
			return ((Airport)o).getUri().equals(uri);
		else if (o.getClass() == Terminal.class)
			return ((Terminal)o).getUri().equals(uri);
		else if (o.getClass() == String.class)
			return ((String) o).equals(uri);
		return o == this;
	}
	
	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return uri.hashCode();
	}
	
	/*public String getLabel() {
		if (label == null)
			return uri;
		else
			return label;
	}*/
	
	public String toString() {
		return uri;
	}

}
